home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / Sample Code / DTS QT Utilities.May-95 / DTSQTUtilities.h < prev    next >
Encoding:
Text File  |  1995-04-30  |  6.5 KB  |  147 lines  |  [TEXT/MPCC]

  1. /*
  2.     File:        DTSUtilities.h
  3.  
  4.     Contains:    QuickTime functions, header file definitions.
  5.  
  6.     Written by:    DTS
  7.  
  8.     Copyright:    © 1994-1995 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.        <1>         12/17/94    khs        first file
  13.        
  14. */
  15.  
  16.  
  17. // Define that this file should only be parsed once, most dev environments know of pragma once.
  18. #pragma once
  19.  
  20.  
  21. // INCLUDES
  22. #include <Gestalt.h>
  23. #include <GestaltEqu.h>
  24. #include <TextUtils.h>
  25. #include <Errors.h>
  26. #include <SegLoad.h>
  27. #include <Printing.h>
  28. #include <Sound.h>
  29.  
  30. #include <Movies.h>
  31. #include "MoviesFormat.h"
  32. #include <Components.h>
  33. #include <QuickTimeComponents.h>
  34. #include <FixMath.h>
  35.  
  36. #include <stdio.h>
  37.  
  38. #ifdef __cplusplus
  39. extern "C" {
  40. #endif
  41.  
  42.  
  43. // Window size constants.
  44. enum eQTUWindowSize {
  45.     kNormalMovieSize = 1L,
  46.     kHalfMovieSize,
  47.     kDoubleMovieSize
  48. };
  49.  
  50. // Rate constant values, Fwd = forward, Bwd = backwards.
  51. enum eQTUMovieRates {    kNoSpeed = 0x00000000,  kFwdSpeed = 0x00010000,
  52.                                         kFwdDoubleSpeed = 0x00020000, kFwdTripleSpeed = 0x00030000,    
  53.                                         kFwdQuadSpeed = 0x00040000, kFwdHalfSpeed = 0x00008000, 
  54.                                         kFwdQuarterSpeed = 0x00004000, kFwdEightspeed = 0x00002000, 
  55.                                         kBwdSpeed = 0xFFFF0000, kBwdDoubleSpeed = 0xFFFE0000, 
  56.                                         kBwdHalfSpeed = 0xFFFF8000 };
  57.  
  58. // MACROS
  59. #if DEBUG
  60. static char gDebugString[256];
  61.  
  62. #define DebugAssert(condition)                                                                        \
  63.         if (condition)        NULL;                                                                            \
  64.     else                                                                                                             \
  65.     {                                                                                                                \
  66.         sprintf(gDebugString,"File: %s, Line: %d", __FILE__, __LINE__);            \
  67.         DebugStr(c2pstr(gDebugString));                                                            \
  68.     }
  69. #else
  70. #define DebugAssert(condition)        NULL
  71. #endif
  72.  
  73. #define MBSTARTTIMER() DebugStr("\pStart! `;mc starttime @ticks;g")
  74. #define MBSTOPTIMER()    DebugStr("\pElapsed time in ticks: '; @ticks - starttime")
  75.  
  76.  
  77. // ReturnIfError is a simple macro around the frequently written code line doing the same (see below)
  78. #define ReturnIfError(theError)  DebugAssert(theError == noErr);  \
  79.                                                     if(theError != noErr) return theError
  80.  
  81.  
  82. // FUNCTION PROTOTYPES
  83.  
  84.  
  85.  
  86. // MOVIE TOOLBOX FUNCTIONS
  87. pascal Boolean             QTUIsQuickTimeInstalled(void);                                                                                        // Check if QT is present.
  88.  
  89. #ifdef powerc
  90. pascal Boolean             QTUIsQuickTimeCFMInstalled(void);                                                                                // Check if QT CFM library is present.
  91. #endif // powerc
  92.  
  93. pascal long                 QTUGetQTVersion();                                                                                                        // Get QT version number.
  94. pascal Boolean             QTUAreQuickTimeMusicInstrumentsPresent(void);                                                            // Test if Musical Instrumentscomponent is present.
  95.  
  96. pascal OSErr                QTUPrerollMovie(Movie theMovie);                                                                                // Preroll Movies before Playback.
  97.  
  98. pascal Boolean             QTUFileFilter(ParmBlkPtr theParamBlock);
  99. pascal Movie             QTUGetMovie(FSSpec *theFSSpec, short *theRefNum, short *theResID);                        // Return a Movie from a file with the movie.
  100. pascal OSErr             QTUSaveMovie(Movie theMovie);                                                                                    // Save the movie (standard dialog box).
  101. pascal OSErr                QTUFlattenMovieFile(Movie theMovie, FSSpec *theFile);                                                // Takes a movie and a file and flattens the movie into the file.
  102. pascal Boolean            QTUPrintMoviePoster(Movie theMovie, short x, short y);                                                // Print the movie poster.
  103. pascal long                QTUCalculateMovieMemorySize(Movie theMovie);                                                            // Return the size of the movie in memory.
  104. pascal OSErr                QTULoadWholeMovieToRAM(Movie theMovie);                                                                // Load the whole movie to RAM.
  105. pascal OSErr                QTUPlayMovieSound(Movie theMovie);                                                                            // Play the movie sound track using the snd resource.
  106. // TRACK & MEDIA
  107. pascal Boolean             QTUMediaTypeInTrack(Movie theMovie, OSType theMediaType);                                    // Check if a Media type is present in a track of a movie.
  108. pascal OSErr                QTUGetTrackRect(Track theTrack, Rect *theRect);                                                        // Get the track rect of a possible video track
  109. pascal short                 QTUGetVideoMediaPixelDepth(Media theMedia, short index);                                            // Get the pixel depth of a video media.
  110. pascal long                QTUCountMediaSamples(Movie theMovie, OSType theMediaType);                                    // Count frames in a movie based on defined media.
  111. pascal TimeValue          QTUGetDurationOfFirstMovieSample(Movie theMovie, OSType theMediaType)    ;                // Get duration of first sample in the track
  112. pascal OSErr             QTUCountMaxSoundRate(Movie theMovie,long *theMaxSoundRate);                                // Return max sound rate from a sound track in a movie.
  113. pascal long                 QTUGetMovieFrameCount(Movie theMovie, long theFrameRate);                                        // Return frames based on frame rate and movie.
  114. pascal OSErr             QTUCopySoundTracks(Movie theSrcMovie, Movie theDestMovie);                                    // Copy sound tracks from source movie to destination movie
  115.  
  116.  
  117. // IMAGE COMPRESSION MANAGER
  118. Boolean                     QTUHasCodecLossLessQuality(CodecType theCodec, short thePixelDepth);                        // Test if a codec has lossless spatial compression.
  119.  
  120.  
  121. // MOVIE CONTROLLER FUNCTIONS
  122. pascal OSErr             QTUPlayMovieWithMC(MovieController mc);                                                                    // Play the movie using the movie controllers.
  123. pascal OSErr              QTUDoIgnoreMCDrags(MovieController  mc);                                                                    // ignore Drag-and-Drop functionality.
  124. pascal Boolean            QTUPointInMC(MovieController mc, WindowRef theWindow, Point where);                        // Check if a point is inside the movie controller rect.
  125. pascal OSErr             QTUSelectAllMovie(MovieController mc);                                                                        // Select the whole time frame from a movie with the mc.
  126. pascal Boolean             QTUResizeMCActionFilter(MovieController mc, short action, void *params, long refCon);
  127. pascal OSErr             QTUResizeMCWindow(MovieController mc, WindowPtr theWindow, long theMovieSize,  Rect originalSize);
  128.  
  129. pascal OSErr                QTUMCSetMovieRate(MovieController mc, long theRate);                                                // Set movie rate using movie controller.
  130.  
  131.  
  132. // SEQUENCE GRABBER FUNCTIONS
  133. pascal SeqGrabComponent QTUCreateSequenceGrabber(WindowPtr theWindow);                                                // Create a sequence grabber instance.
  134. pascal OSErr                     QTUCreateSGGrabChannels(SeqGrabComponent s, const Rect *theBounds, 
  135.                                             long theUsage, SGChannel *theVideoChannel, SGChannel *theSoundChannel);         // Create sequence grabber channels.
  136. pascal Boolean                     QTUDoesVDIGReceiveVideo(SeqGrabComponent s);                                                    // Do we have live incoming video?
  137. pascal OSErr                     QTUChangeSGWindowSize(SeqGrabComponent s,SGChannel videoChannel,                 // Change the window size of Sequence Grabber window
  138.                                             WindowPtr theWindow, long width, long height);
  139.  
  140. // COMPONENT FUNCTIONS
  141. pascal Component         QTUDoGetComponent(OSType theComponentType, OSType theSpecificComponent);
  142. pascal Boolean             QTUHasComponentType(OSType theComponentType, OSType theSpecificComponent);
  143.  
  144.  
  145. #ifdef __cplusplus
  146. }
  147. #endif